import { httpPost, httpGet, httpDel, httpPut } from '../index'

export function page (query) {
  return httpGet('/api/admin/user', query)
}

export function addObj (obj) {
  return httpPost('/api/admin/user', obj)
}

export function getObj (id) {
  return httpGet('/api/admin/user/' + id)
}

export function delObj (id) {
  return httpDel('/api/admin/user/' + id)
}

export function putObj (obj) {
  return httpPut('/api/admin/user/', obj)
}

export function putUserRole (id, roleIds) {
  return httpPut('/api/admin/user/' + id + '/role', { roleIds })
}

export function putUserPassword (username, oldPassword, password) {
  return httpPut('/api/admin/user/password', { username, oldPassword, password })
}

export function exportObjs (format) {
  return httpGet('/api/admin/user/excel', { format })
}
